package array;

import java.util.HashMap;

public class leetCode167_twoSum {

    public static void main(String[] args) {
        int[] aa = {3,2,4};
        int target = 6;
        leetCode167_twoSum b = new leetCode167_twoSum();
        int[] ints = b.twoSum(aa, target);
        System.out.println(1);

    }
    public int[] twoSum(int[] nums, int target) {
        if(nums == null || nums.length == 0){
            return new int[]{-1,-1};
        }
        int left = 0;
        int right = nums.length - 1;
        while (left < right){
            int sum = nums[left] + nums[right];
            if(sum < target){
                left++;
            }else if(sum > target){
                right--;
            }else{
                return new int[]{left,right};
            }
        }
        return new int[]{-1,-1};

    }

}
